//
//  Common.h
//  LBBase
//
//  Created by Gary on 15/7/1.
//  Copyright (c) 2015年 Lebo. All rights reserved.
//

#ifndef ConfigDefine_h
#define ConfigDefine_h

#pragma mark - 定制相关的一些配置参数f

//是否在生产环境中运行
#ifndef RUN_IN_PRODUCTION_ENV
#define RUN_IN_PRODUCTION_ENV
#endif

//在此开启或关闭支付的生产环境运行的开关
#undef RUN_IN_PRODUCTION_ENV  //注释放开后会在测试环境中运行

//测试环境的参数
static const NSString *kBaseServerURL                   = @"http://188.188.23.110:8888/chezhibao-api/apiService.hs";

//生产环境的参数
static const NSString *kBaseServerURLProduction         = @"http://api.mychebao.com/chezhibao-api/apiService.hs";

//程序当前版本
#define kNetReqParamVersionKey                              @"version"
#define kAppCurrentVersion                                  @"9.1.0"
#ifndef kAppCurrentVersion
#define kAppCurrentVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
#endif

//Url Type
static const NSString *kAppUrlTypeIdentifier            = @"com.Lebo.Channel";

//客户端请求时client
static const NSString *kNetReqParamClientKey            = @"client";
#define kNetReqParamClient                                  [NSNumber numberWithInt:2]
#define SetClient(dic) [dic setObject:kNetReqParamClient forKey:kNetReqParamClientKey]

//百度统计APPKey
#define kBaiduMobStatAPPKey           @"516fe640b9"
#define kBaiduMobStatTestChannel      @"lebo_test"
#define kBaiduMobStatReleaseChannel   @"lebo"

//默认参数
#define kDateTimeFormatDefault        @"yyyy-MM-dd HH:mm:ss"
#define kPlaceholderImageMin          [UIImage imageNamed:@"default_item_min"]
#define kPlaceholderImage             [UIImage imageNamed:@"default_item"]
#define kImageSuffixNormal            @".jpg"
#define kImageSuffixMin               @"_min.jpg"
#define kImageSuffixMid               @"_mid.jpg"
#define kImageSuffixMax               @"_max.jpg"

//在[[NSUserDefaults standardUserDefaults] objectForKey:(NSString *)]使用的KEY
//格式为前缀"kUSKey" + 带语意的后缀
#define kUSKeyIsProductionEnv                   @"IsProductionEnv"
#define kUSKeyIsPaymentProductionEnv            @"IsPaymentProductionEnv"
#define kUSKeyHomeBiddingIsFirstShow            @"HomeLoadingIsFirstShow"
#define kUSKeyHomeWaitingIsFirstShow            @"HomeWaitingIsFirstShow"
#define kUSKeyHomeFocusIsFirstShow              @"HomeFocusIsFirstShow"
#define kUSKeyHomeTransIsFirstShow              @"HomeTransactionIsFirstShow"
#define kUSKeyProfileIsFirstShow                @"ProfileIsFirstShow"
#define kUSKeyCarDetectionIsFirstShow           @"CarDetectionIsFirstShow"
#define kUSKeyCurrentDeviceToken                @"CurrentDeviceToken"
#define kUSKeyRegisterParamDic                  @"RegisterParamDic"
#define kUSKeyMessageMaxId                      @"MessageMaxId"

//相关枚举

/**
 常见网络请求返回码
 */
typedef enum NetworkResponseCode {
    NetworkResponseCodeSucc                                 = 0,
    NetworkResponseCodeLoginExpired                         = 20120,
    NetworkResponseCodeAnotherLogined                       = 20112,
} NetworkResponseCode;

/**
 整数值表示业务的布尔值
 */
typedef enum IntForBool {
    IntForBoolFalse                                         = 0,//否
    IntForBoolTrue                                          = 1,//是
} IntForBool;

/**
 首页列表类型
 */
typedef enum HomeTabListType {
    HomeTabListTypeBidding                                  = 1,//正在竞拍
    HomeTabListTypeWaiting,                     //等待竞拍
    HomeTabListTypeFocus,                       //关注
    HomeTabListTypeTransNotCompleted,           //未交易记录
    HomeTabListTypeTransCompleted,              //已交易记录
    HomeTabListTypeBidHistory,                  //出价记录
} HomeTabListType;

#pragma mark - 网络请求接口名

static const NSString *kCommonParamName                 = @"name";
static const NSString *kCommonParamId                   = @"id";
static const NSString *kCommonParamLogo                 = @"logo";
static const NSString *kCommonParamType                 = @"type";
static const NSString *kCommonParamTotle                = @"totle";
static const NSString *kCommonParamTotal                = @"total";
static const NSString *kCommonParamDescription          = @"description";
static const NSString *kCommonParamImg                  = @"img";
static const NSString *kCommonParamTitle                = @"title";
static const NSString *kCommonParamStatus               = @"status";
static const NSString *kCommonParamKind                 = @"kind";

#pragma mark - 配置文件

//省市区地理区域
#define kConfigFileProvinceList [kResourceDirectory stringByAppendingPathComponent:@"json/province.json"]
#define kConfigFileCityList [kResourceDirectory stringByAppendingPathComponent:@"json/city.json"]
#define kConfigFileRegionList [kResourceDirectory stringByAppendingPathComponent:@"json/region.json"]
static const NSString *kConfigKeyCity                   = @"city";
static const NSString *kConfigKeyRegion                 = @"region";
static const NSString *kConfigKeyPid                    = @"pid";

#pragma mark - 默认参数

#define kAnyCityId                              0
#define kAnyCityName                            [Common getLocalStr:@"SelectCityAnyCityText"]
#define kAnyCityDictionary                      @{kCommonParamId : @(kAnyCityId), kCommonParamName : kAnyCityName}
#define kCustomerAlertSubViewMarginHorizontal   10.f        //自定义弹出框水平方向上的间隔
#define kCustomerAlertSubViewMarginVertical     20.f        //自定义弹出框垂直方向上的间隔
#define kServicePhoneNumber                     @"400-6621-000"//客服电话

static const NSInteger kBankCardNoLengthMin             = 14;//银行卡号最短长度
static const NSInteger kBankCardNoLengthMax             = 19;//银行卡号最大长度
static const NSInteger kBankCardNoGroupLength           = 4;//银行卡号分组长度

#pragma mark - 页面之间通知Notification的Key

#define kPageNotificationKeyCitySelected                @"CitySelected"

#pragma mark - 网络请求或返回的参数

static const NSString *kNetReqParamTokenKey             = @"token";
static const NSString *kNetReqParamSignKey              = @"session";
static const NSString *kNetReqParamServiceKey           = @"service";
#define SetService(dic, service) SetClient(dic);                    \
[dic setObject:[Common currentToken] forKey:kNetReqParamSignKey];   \
[dic setObject:service forKey:kNetReqParamServiceKey]

//页面显示
static const NSString *kDataListPageKey                 = @"page";
static const NSString *kDataListRowKey                  = @"rows";
static const NSString *kDataListOffsetKey               = @"offset";
static const NSInteger kPageSizeDefault                 = 10;//默认一页显示的数量
static const NSInteger kPageSizeInfinite                = 10000000;//无限制显示的数量
//#define kDataListPageSize [Common dataListPageSize]
#define kDataListPageSize kPageSizeDefault  //更换为一页固定显示10个

/**
 *  个人信息
 */
static const NSString *kAPIParamUserName                = @"username";
static const NSString *kAPIParamPassword                = @"password";

#pragma mark - 网络请求的Service

//
static const NSString *kNetReqNameGet                   = @"get";

//
static const NSString *kNetReqNamePost                  = @"post";

//登录
static const NSString *kNetReqPostLogin                 = @"auction.buyer.login";

//获取个人资料
static const NSString *kNetReqPostGetProfile            = @"auction.buyer.mycenter";

//获取车辆品牌
static const NSString *kNetReqPostGetBrandList          = @"auction.base.brand";

#endif
